import request from '@/utils/request'

/**
 * 顾客申请退货
 */
export function applyRefund(data) {
  return request({
    url: '/refund/apply',
    method: 'post',
    data
  })
}

/**
 * 员工/管理员处理退货
 */
export function handleRefund(id, data) {
  return request({
    url: `/refund/${id}/handle`,
    method: 'put',
    data
  })
}

/**
 * 查询用户自己的退货记录列表
 */
export function getMyRefundList() {
  return request({
    url: '/refund/my',
    method: 'get'
  })
}

/**
 * 查询所有退货记录（分页）- 员工/管理员
 */
export function getRefundList(params) {
  return request({
    url: '/refund/list',
    method: 'get',
    params
  })
}

/**
 * 获取退货详情
 */
export function getRefundDetail(id) {
  return request({
    url: `/refund/${id}`,
    method: 'get'
  })
}

/**
 * 根据订单ID查询退货记录
 */
export function getRefundByOrderId(orderId) {
  return request({
    url: `/refund/order/${orderId}`,
    method: 'get'
  })
}

/**
 * 用户取消退货申请
 */
export function cancelRefund(id) {
  return request({
    url: `/refund/${id}`,
    method: 'delete'
  })
}





